/**
 * 前置处理器
 * 
 */
class PreProcessor {

    /**
     * JSR223 预处理程序
     * 
     * @param {XMLBuilder} parent 
     * @param {{ testname: String, comments: String, script: String }} config 
     * @returns 
     */
    createJsr223PreProcessor(parent, config = { testname: "JSR223 PreProcessor", comments: "", script: "" }) {
        const { testname, comments, script } = config;
        const jmxJsr223PreProcessor = parent.ele("JSR223PreProcessor", { guiclass: "TestBeanGUI", testclass: "JSR223PreProcessor", testname: testname });
        jmxJsr223PreProcessor.ele("stringProp", { name: "cacheKey" }).txt("true").up()
            .ele("stringProp", { name: "filename" }).txt("").up()
            .ele("stringProp", { name: "parameters" }).txt("").up()
            .ele("stringProp", { name: "script" }).txt(script).up()
            .ele("stringProp", { name: "scriptLanguage" }).txt("groovy").up()
            .ele("stringProp", { name: "TestPlan.comments" }).txt(comments);
        jmxJsr223PreProcessor.up().ele("hashTree");
    }

}

module.exports = PreProcessor;

